package com.suke.czx.modules.contact.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.suke.czx.common.validate.ContactSaveGroup;
import com.suke.czx.common.validate.ContactUpdateGroup;
import com.suke.czx.common.validate.CustomerUpdateGroup;
import com.suke.czx.common.validate.EnumValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 应用模块名称: 联系人
 * 代码描述: 联系人实体
 * copyright: AUZAR ALL RIGHTS RESERVED
 * company: AUZAR
 *
 * @author: 颜米晨
 * @date: 2021/09/01 14:38:49
 */
@Data
@ApiModel(value = "联系人管理")
@EqualsAndHashCode(callSuper = true)
public class Contact extends Model<Contact> {

    @ApiModelProperty(value = "联系人id")
    @TableId(value = "contact_id", type = IdType.AUTO)
    @NotNull(groups = {ContactUpdateGroup.class}, message = "联系人编码不能为空")
    public Long contactId;

    @ApiModelProperty(value = "联系人姓名")
    @NotBlank(groups = {ContactSaveGroup.class, ContactUpdateGroup.class}, message = "联系人姓名不能为空")
    public String contactName;

    @ApiModelProperty(value = "性别: 0男 1女")
    @EnumValue(groups = {ContactSaveGroup.class, ContactUpdateGroup.class}, intValues = {0, 1}, message = "性别只能是0,1")
    public Integer sex;

    @ApiModelProperty(value = "联系方式")
    public String contactWay;

    @ApiModelProperty(value = "岗位")
    public String jobs;

    @ApiModelProperty(value = "邮箱")
    public String email;

    @ApiModelProperty(value = "地址")
    public String address;

    @ApiModelProperty(value = "私人电话")
    public String privateContactWay;

    @ApiModelProperty(value = "喜好")
    public String hobbies;

    @ApiModelProperty(value = "联系人类型:1-客户,2-供应商")
    @NotNull(groups = {ContactSaveGroup.class, CustomerUpdateGroup.class}, message = "联系人类型不能为空")
    @EnumValue(groups = {ContactSaveGroup.class, ContactUpdateGroup.class}, intValues = {1, 2}, message = "联系人类型只能是1,2")
    public Integer type;

    @ApiModelProperty(value = "客户/供应商id")
    @NotNull(groups = {ContactSaveGroup.class, CustomerUpdateGroup.class}, message = "客户/供应商编码不能为空")
    public Long relationId;

    @ApiModelProperty(value = "备注")
    public String note;

    @ApiModelProperty(value = "删除标记 0：删除 1：正常")
    public Integer del;

    @ApiModelProperty(value = "创建者id")
    public Long creator;

    @ApiModelProperty(value = "创建时间")
    public Date createTime;

    @ApiModelProperty(value = "更新者id")
    public Long updater;

    @ApiModelProperty(value = "更新时间")
    public Date updateTime;

}
